//
//  FSCObjectiveListModel.swift
//  FamiliesSchoolConnection
//
//  Created by 花花蔡 on 2017/1/3.
//  Copyright © 2017年 com.HuaHuaCai. All rights reserved.
//

import UIKit

class FSCObjectiveListModel {

    var objectiveModelArr = [FSCObjectiveModel] ()
    
    func downLoadData(finish:@escaping (_ isOk:Bool) -> ()) -> Void {
        let urlStr = "ZH-schoolname-S-getHomeworkCheck"
        let id = hw_id
//        print(hw_id)
        let parm = ["key":userID,"hw_id":id] as [String : Any]
        FSCNetworkTools.shared.request(url: urlStr, parameters: parm) { (data, error) in
            guard let data = data as? [String:Any] else {
                return
            }
        print(data)
            switch data["result"] as! Int {
                case 0:
                    print(data)
                    guard let dictArr = data["data"] as? [[String:Any]] else {
                        return
                }
                    for dict in dictArr {
                        let model = FSCObjectiveModel(dict: dict)
                        self.objectiveModelArr.append(model)
                }
                finish(true)
            case 1:
                HSAlertView.bottomAlertView("加载失败")
                finish(false)
            default:
                break
            }
        }
    }
    
    
}
